import { Customer } from "@/api/interface/customer";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name 客户维护接口
 */

// 查询全部客户
export const getCompanyPage = (params: Customer.ReqCustomer) => {
  return http.post<Customer.ResCustomerData>(PORT1 + `/company/page`, params);
};

// 添加客户
export const addCompany = (params: Customer.ResCustomerData) => {
  return http.post(PORT1 + `/company/add`, params);
};

// 修改客户
export const updateCompany = (params: Customer.ResCustomerData) => {
  return http.post(PORT1 + `/company/update`, params);
};

// 删除客户
export const delCompany = (params: Customer.ReqCustomer) => {
  return http.get(PORT1 + `/company/delete`, params);
};

// 客户详情
export const getCompanyDetail = (params: Customer.ReqCustomer) => {
  return http.get(PORT1 + `/company/detail`, params);
};

// 查询全部客户公司信息
export const getCompanyList = () => {
  return http.get<Customer.ResCustomerData>(PORT1 + `/company/list`);
};

// 批量修改客户公司负责人
export const updateUserApi = (params: Customer.ResCustomerData) => {
  return http.post<Customer.ResCustomerData>(PORT1 + `/company/update/user`, params);
};
// 查询组织架构公司列表
export const getCompanyDepart = () => {
  return http.get<Customer.ResCustomerData>(PORT1 + `/department/company/all`, {}, { noLoading: true }); // /company/depart
};

// 客户跟进下API

// 查询全部客户
export const getFollowPage = (params: Customer.ReqCustomer) => {
  return http.post<Customer.ResCustomerData>(PORT1 + `/company/follow/page`, params);
};

// 添加客户
export const addFollow = (params: Customer.ResCustomerData) => {
  return http.post(PORT1 + `/company/follow/add`, params);
};

// 修改客户
export const updateFollow = (params: Customer.ResCustomerData) => {
  return http.post(PORT1 + `/company/follow/update`, params);
};

// 删除客户
export const delFollow = (params: Customer.ReqCustomer) => {
  return http.get(PORT1 + `/company/follow/delete`, params);
};

// 客户详情
export const getFollowDetail = (params: Customer.ReqCustomer) => {
  return http.get(PORT1 + `/company/follow/detail`, params);
};
